package com.person.leetcode.editor.cn;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 728.自除数
 * 2022-03-31 15:37:21
 **/
public class Sequence_0728_SelfDividingNumbers {
    public static void main(String[] args) {
        Solution solution = new Sequence_0728_SelfDividingNumbers().new Solution();
        String s = "123";
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            int num = Integer.parseInt(c + "");
            System.out.println(num);
        }
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    //大傻子为啥不循环取余
    class Solution {
        public List<Integer> selfDividingNumbers(int left, int right) {
            ArrayList<Integer> integers = new ArrayList<>();
            for (int i = left; i < right + 1; i++) {
                String s = String.valueOf(i);
                Map<Integer, Object> map = new HashMap<>();
                boolean status = true;
                for (int j = 0; j < s.length(); j++) {
                    char c = s.charAt(j);
                    int anInt = Integer.parseInt(c + "");

                    status = anInt != 0 && i % anInt == 0 && status;
                }
                if (status) {
                    integers.add(i);
                }
            }
            return integers;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
